use "BJPS_AB3_Data.dta", clear



	**** CORRELATION MATRIX
estimates clear
estpost corr ConEqual01  SameRights01 MinorityRight01 PracticesPrivate01 MosquesShouldnt01 ShouldntInfluence01 if Muslim == 1, matrix
esttab . using corr.tex, not unstack compress noobs nostar label replace



 set more off

*Table A5

eststo clear

 * Constitution

reg ConEqual01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
eststo

*Non-Muslims Same Rights

reg SameRights01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004 i.country##c.q1014 if Muslim == 1  
eststo

*Minority Practice

reg MinorityRight01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014   if Muslim == 1
eststo

*Private Religious Practice

reg PracticesPrivate01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
eststo

*Mosques and Elections

reg MosquesShouldnt01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004    i.country##c.q1014 if Muslim == 1
eststo

*Religious Institutions

reg ShouldntInfluence01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014 if Muslim == 1
eststo

*Outputting

esttab using table_a5.tex,  se b(%9.2f) star(* 0.1 ** 0.05 *** 0.01)  replace label tex r2 compress 






* Combining AB3 and AB5
*** FIGURE 1

eststo clear

*Constitution Equal Rights

reg ConEqual01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store A

*Non-Muslims Same Rights

reg SameRights01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004 i.country##c.q1014 if Muslim == 1  
margins, dydx(Friday) over(AlwaysMost) post
estimates store B 

*Minority Practice

reg MinorityRight01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014   if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store C

*Private Religious Practice

reg PracticesPrivate01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store D

*Mosques and Elections

reg MosquesShouldnt01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004    i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store E

*Religious Institutions

reg ShouldntInfluence01 i.Friday##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store F

 

	
coefplot A B C D E F, xline(0) scheme(s1mono) legend(size(small) position(9) cols(1)) graphregion(color(white)) bgcolor(white) plotlabels("Constitution should ensure equal rights for non-Muslims" "Non-Muslims should have the same rights in Muslim countries" "Religious minorities have right to practice" "Religious practices private & should be separate from pol/social life" "Mosques should not be used for election campaigning" "Rel. associations should not influence voter decisions", wrap(35)) levels(95 90) saving(ab3_combined, replace) title(Arab Barometer Wave 3) 

*graph combine ab3_combined.gph ab5_combined.gph, scheme(s1mono) cols(1) xcommon ycommon





*** FIGURE 2
	
	*** EGYPT
	estimates clear
	foreach var of varlist  ConEqual01  SameRights01 MinorityRight01 PracticesPrivate01 MosquesShouldnt01 ShouldntInfluence01 {
	reg `var' i.Friday##c.AlwaysMost  Prayer01  q1001 q1002 q1003 q1004 q1014 if Muslim == 1 & country == 2
	margins, dydx(Friday) over(AlwaysMost) post
	estimates store egypt_`var'
	}

coefplot egypt_*, saving(egypt_alt_greyscale, replace) scheme(s1mono) title("Egypt") ytitle("") xline(0) xlabel(, grid)  grid(between glpattern(dash) glwidth(*2) glcolor(gray)) legend(position(6) cols(1))  plotlabels("Constitution should ensure equal rights for non-Muslims" "Non-Muslims should have the same rights in Muslim countries" "Religious minorities have right to practice" "Rel. practices private & should be separate from pol/social life" "Mosques should not be used for election campaigning" "Rel. associations should not influence voter decisions")

graph export egypt_alt_greyscale.pdf, as(pdf) replace

	*** ALGERIA:
	estimates clear
	foreach var of varlist  ConEqual01  SameRights01 MinorityRight01 PracticesPrivate01 MosquesShouldnt01 ShouldntInfluence01 {
	reg `var' i.Friday##c.AlwaysMost  Prayer01  q1001 q1002 q1003 q1004 q1014 if Muslim == 1 & country == 1
	margins, dydx(Friday) over(AlwaysMost) post
	estimates store `var'
	}

coefplot *, saving(algeria_alt_greyscale, replace) scheme(s1mono) title("Algeria") ytitle("") xline(0) xlabel(, grid)  grid(between glpattern(dash) glwidth(*2) glcolor(gray)) legend(position(6) cols(1))  plotlabels("Constitution should ensure equal rights for non-Muslims" "Non-Muslims should have the same rights in Muslim countries" "Religious minorities have right to practice" "Rel. practices private & should be separate from pol/social life" "Mosques should not be used for election campaigning" "Rel. associations should not influence voter decisions")
		
graph export algeria_alt_greyscale.pdf, as(pdf) replace

grc1leg egypt_alt_greyscale.gph algeria_alt_greyscale.gph, scheme(s1mono)

graph export egy_alg_alt_greyscale.pdf, as(pdf) replace



**** SUMMARY STATS:
la var AlwaysMost "Attends Always Most"
la var q1001 "Age"
la var q1002 "Female"
la var q1003 "Education"
la var q1004 "Unemployed"
la var q1014 "Income (Country-Specific)"
la var ConEqual01 "Constitution Equal Rights Non-Muslims"
la var SameRights01 "Non-Muslims Same Rights in Muslim Countries"
la var MinorityRight01 "Rel. Minorities Have Right to Practice"
la var PracticesPrivate01 "Rel. Practices are Private"
la var MosquesShouldnt01 "Mosques Shouldn't be Used for Campaigns"
la var ShouldntInfluence01 "Rel. Associations Shouldn't Influence Voters"

sutex ConEqual01  SameRights01 MinorityRight01 PracticesPrivate01 MosquesShouldnt01 ShouldntInfluence01  AlwaysMost  Prayer01  q1001 q1002 q1003 q1004 q1014 Friday if Muslim == 1, digits(2) labels minmax 



	**** FIGURE A1
eststo clear
*Constitution Equal Rights
reg ConEqual01 i.Friday##c.AlwaysMost i.q503 c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store A
*Non-Muslims Same Rights
reg SameRights01 i.Friday##c.AlwaysMost   i.q503  c.Prayer01 q1001 q1002 q1003 q1004 i.country##c.q1014 if Muslim == 1  
margins, dydx(Friday) over(AlwaysMost) post
estimates store B 
*Minority Practice
reg MinorityRight01 i.Friday##c.AlwaysMost  i.q503  c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014   if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store C
*Private Religious Practice
reg PracticesPrivate01 i.Friday##c.AlwaysMost   i.q503  c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store D
*Mosques and Elections
reg MosquesShouldnt01 i.Friday##c.AlwaysMost   i.q503  c.Prayer01 q1001 q1002 q1003 q1004    i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store E
*Religious Institutions
reg ShouldntInfluence01 i.Friday##c.AlwaysMost  i.q503  c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store F
coefplot A B C D E F, xline(0) scheme(s1mono) legend(size(small) position(9) cols(1)) graphregion(color(white)) bgcolor(white) plotlabels("Constitution should ensure equal rights for non-Muslims" "Non-Muslims should have the same rights in Muslim countries" "Religious minorities have right to practice" "Religious practices private & should be separate from pol/social life" "Mosques should not be used for election campaigning" "Rel. associations should not influence voter decisions", wrap(35)) levels(95 90) saving(ab3_combined_parties, replace) title(Arab Barometer Wave 3) 

*graph combine ab3_combined_parties.gph ab5_combined_parties.gph, scheme(s1mono) cols(1) xcommon ycommon


	**** FIGURE A2
eststo clear
*Constitution Equal Rights
reg ConEqual01 i.Friday##c.AlwaysMost TrustIslamistParties c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store A
*Non-Muslims Same Rights
reg SameRights01 i.Friday##c.AlwaysMost  TrustIslamistParties c.Prayer01 q1001 q1002 q1003 q1004 i.country##c.q1014 if Muslim == 1  
margins, dydx(Friday) over(AlwaysMost) post
estimates store B 
*Minority Practice
reg MinorityRight01 i.Friday##c.AlwaysMost TrustIslamistParties c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014   if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store C
*Private Religious Practice
reg PracticesPrivate01 i.Friday##c.AlwaysMost  TrustIslamistParties c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store D
*Mosques and Elections
reg MosquesShouldnt01 i.Friday##c.AlwaysMost  TrustIslamistParties c.Prayer01 q1001 q1002 q1003 q1004    i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store E
*Religious Institutions
reg ShouldntInfluence01 i.Friday##c.AlwaysMost TrustIslamistParties c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store F
coefplot A B C D E F, xline(0) scheme(s1mono) legend(position(6) cols(1) ) graphregion(color(white)) bgcolor(white) plotlabels("Constitution should ensure equal rights for non-Muslims" "Non-Muslims should have the same rights in Muslim countries" "Religious minorities have right to practice" "Religious practices private & should be separate from pol/social life" "Mosques should not be used for election campaigning" "Rel. associations should not influence voter decisions") levels(95 90) saving(ab3_combined, replace) 

 
	**** FIGURE A3
eststo clear
*Constitution Equal Rights
reg ConEqual01 i.Friday##c.AlwaysMost q102a c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store A
*Non-Muslims Same Rights
reg SameRights01 i.Friday##c.AlwaysMost  q102a   c.Prayer01 q1001 q1002 q1003 q1004 i.country##c.q1014 if Muslim == 1  
margins, dydx(Friday) over(AlwaysMost) post
estimates store B 
*Minority Practice
reg MinorityRight01 i.Friday##c.AlwaysMost  q102a  c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014   if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store C
*Private Religious Practice
reg PracticesPrivate01 i.Friday##c.AlwaysMost  q102a   c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store D
*Mosques and Elections
reg MosquesShouldnt01 i.Friday##c.AlwaysMost   q102a c.Prayer01 q1001 q1002 q1003 q1004    i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store E
*Religious Institutions
reg ShouldntInfluence01 i.Friday##c.AlwaysMost  q102a c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store F
coefplot A B C D E F, xline(0) scheme(s1mono) legend(position(6) cols(1) ) graphregion(color(white)) bgcolor(white) plotlabels("Constitution should ensure equal rights for non-Muslims" "Non-Muslims should have the same rights in Muslim countries" "Religious minorities have right to practice" "Religious practices private & should be separate from pol/social life" "Mosques should not be used for election campaigning" "Rel. associations should not influence voter decisions") levels(95 90) saving(ab3_combined_living_conditions, replace) 

 *** FIGURE A4
eststo clear
*Constitution Equal Rights
reg ConEqual01 i.Friday##c.AlwaysMost q101 c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store A
*Non-Muslims Same Rights
reg SameRights01 i.Friday##c.AlwaysMost  q101   c.Prayer01 q1001 q1002 q1003 q1004 i.country##c.q1014 if Muslim == 1  
margins, dydx(Friday) over(AlwaysMost) post
estimates store B 
*Minority Practice
reg MinorityRight01 i.Friday##c.AlwaysMost  q101  c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014   if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store C
*Private Religious Practice
reg PracticesPrivate01 i.Friday##c.AlwaysMost  q101   c.Prayer01 q1001 q1002 q1003 q1004  i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store D
*Mosques and Elections
reg MosquesShouldnt01 i.Friday##c.AlwaysMost   q101 c.Prayer01 q1001 q1002 q1003 q1004    i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store E
*Religious Institutions
reg ShouldntInfluence01 i.Friday##c.AlwaysMost  q101 c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014 if Muslim == 1
margins, dydx(Friday) over(AlwaysMost) post
estimates store F
coefplot A B C D E F, xline(0) scheme(s1mono) legend(position(6) cols(1) ) graphregion(color(white)) bgcolor(white) plotlabels("Constitution should ensure equal rights for non-Muslims" "Non-Muslims should have the same rights in Muslim countries" "Religious minorities have right to practice" "Religious practices private & should be separate from pol/social life" "Mosques should not be used for election campaigning" "Rel. associations should not influence voter decisions") levels(95 90) saving(ab3_combined_econsat, replace) 



*** FIGURE A5
	*** GENDER DIFFERENCES
	estimates clear
	foreach var of varlist  ConEqual01  SameRights01 MinorityRight01 PracticesPrivate01 MosquesShouldnt01 ShouldntInfluence01 {
	reg `var' i.Friday##c.AlwaysMost   Prayer01  q1001 q1003 q1004 c.q1014##i.country if Muslim == 1  & q1002 == 1
	margins, dydx(Friday) over(AlwaysMost) post
	estimates store male_`var'
	}
	
		*** GENDER DIFFERENCES
		foreach var of varlist  ConEqual01  SameRights01 MinorityRight01 PracticesPrivate01 MosquesShouldnt01 ShouldntInfluence01 {
	reg `var' i.Friday##c.AlwaysMost   Prayer01  q1001 q1003 q1004 c.q1014##i.country if Muslim == 1  & q1002 == 2
	margins, dydx(Friday) over(AlwaysMost) post
	estimates store female_`var'
	}
	
coefplot male*, saving(men_ab3, replace) scheme(s1mono) title("Men") ytitle("") xline(0) xlabel(, grid)  grid(between glpattern(dash) glwidth(*2) glcolor(gray)) legend(position(6) cols(1))  plotlabels("Constitution should ensure equal rights for non-Muslims" "Non-Muslims should have the same rights in Muslim countries" "Religious minorities have right to practice" "Rel. practices private & should be separate from pol/social life" "Mosques should not be used for election campaigning" "Rel. associations should not influence voter decisions")

coefplot female*, saving(women_ab3, replace) scheme(s1mono) title("Women") ytitle("") xline(0) xlabel(, grid)  grid(between glpattern(dash) glwidth(*2) glcolor(gray)) legend(position(6) cols(1))  plotlabels("Constitution should ensure equal rights for non-Muslims" "Non-Muslims should have the same rights in Muslim countries" "Religious minorities have right to practice" "Rel. practices private & should be separate from pol/social life" "Mosques should not be used for election campaigning" "Rel. associations should not influence voter decisions")
		
grc1leg men_ab3.gph women_ab3.gph, scheme(s1mono)

 

	**** FIGURE A7
estimates clear
foreach var of varlist  ConEqual01  SameRights01 MinorityRight01 PracticesPrivate01 MosquesShouldnt01 ShouldntInfluence01 {
 reg `var' i.DayOfWeek##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014 if Muslim == 1
margins, at(AlwaysMost = 1) over(DayOfWeek) post saving(days_`var', replace)
 reg `var' i.DayOfWeek##c.AlwaysMost c.Prayer01 q1001 q1002 q1003 q1004   i.country##c.q1014 if Muslim == 1
margins, at(AlwaysMost = 0) over(DayOfWeek) post saving(days_nonattenders_`var', replace)
*estimates store est_`var'
*marginsplot, x(DaysFromFriday) scheme(s1mono) saving(plot_`var', replace)
}



combomarginsplot days_ConEqual01 days_SameRights01 days_MinorityRight01 days_PracticesPrivate01 days_MosquesShouldnt01 days_ShouldntInfluence01, x(DayOfWeek) scheme(s1mono) noci labels("Constitution should ensure equal rights for non-Muslims" "Non-Muslims should have the same rights in Muslim countries" "Religious minorities have right to practice" "Rel. practices private & should be separate from pol/social life" "Mosques should not be used for election campaigning" "Rel. associations should not influence voter decisions") legend(cols(1)) title("Attenders") ytitle(Predicted Value) xtitle(Day of Interview) xlab(,labsize(small) angle(45)) saving(days_attenders, replace) ylab(0.6(0.1)0.8,labsize(small))


combomarginsplot days_nonattenders_ConEqual01 days_nonattenders_SameRights01 days_nonattenders_MinorityRight01 days_nonattenders_PracticesPrivate01 days_nonattenders_MosquesShouldnt01 days_nonattenders_ShouldntInfluence01, x(DayOfWeek) scheme(s1mono) noci labels("Constitution should ensure equal rights for non-Muslims" "Non-Muslims should have the same rights in Muslim countries" "Religious minorities have right to practice" "Rel. practices private & should be separate from pol/social life" "Mosques should not be used for election campaigning" "Rel. associations should not influence voter decisions") legend(cols(1)) title("Non-Attenders") ytitle(Predicted Value) xtitle(Day of Interview) xlab(,labsize(small) angle(45)) saving(days_nonattenders, replace) ylab(0.6(0.1)0.8,labsize(small))


grc1leg days_attenders.gph days_nonattenders.gph, ycommon scheme(s1mono) 



